package com.noshufou.android.su;

import android.app.AlertDialog;
import android.app.AlertDialog.Builder;
import android.app.NotificationManager;
import android.content.Context;
import android.content.DialogInterface;
import android.content.DialogInterface.OnClickListener;
import android.content.res.Resources;
import android.database.SQLException;
import android.database.sqlite.SQLiteDatabase;
import android.os.AsyncTask;
import android.os.Build.VERSION;
import android.os.Bundle;
import android.support.v4.app.FragmentActivity;
import android.support.v4.app.ListFragment;
import android.text.Spannable;
import android.text.style.ForegroundColorSpan;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.Button;
import android.widget.ProgressBar;
import android.widget.TextView;
import com.noshufou.android.su.util.Util;
import java.io.BufferedReader;
import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.File;
import java.io.IOException;
import java.io.InputStreamReader;
import org.json.JSONException;
import org.json.JSONObject;

public class UpdaterFragment extends ListFragment
  implements View.OnClickListener
{
  public static final int NOTIFICATION_ID = 42;
  private static final String TAG = "Su.UpdaterFragment";
  private int CONSOLE_GREEN;
  private int CONSOLE_GREY;
  private int CONSOLE_RED;
  private String MANIFEST_URL;
  private Button mActionButton;
  private String mBusyboxPath = "";
  private Step mCurrentStep = Step.DOWNLOAD_MANIFEST;
  private Manifest mManifest;
  private ProgressBar mProgressBar;
  private TextView mStatusText;
  private ProgressBar mTitleProgress;
  private UpdateTask mUpdateTask;

  private void addConsoleEntry(int paramInt)
  {
    ConsoleEntry localConsoleEntry = new ConsoleEntry(paramInt);
    getListAdapter().add(localConsoleEntry);
  }

  private void addStatusToEntry(int paramInt1, int paramInt2)
  {
    addStatusToEntry(getActivity().getString(paramInt1), paramInt2);
  }

  private void addStatusToEntry(String paramString, int paramInt)
  {
    ConsoleEntry localConsoleEntry = (ConsoleEntry)getListAdapter().getItem(-1 + getListAdapter().getCount());
    localConsoleEntry.status = paramString;
    localConsoleEntry.statusColor = paramInt;
  }

  private String executeCommand(DataOutputStream paramDataOutputStream, BufferedReader paramBufferedReader, int paramInt, String[] paramArrayOfString)
    throws IOException
  {
    String str = null;
    if (paramArrayOfString.length == 0)
      break label77;
    label9: StringBuilder localStringBuilder;
    int j;
    label29: int k;
    while (true)
    {
      return str;
      localStringBuilder = new StringBuilder();
      int i = paramArrayOfString.length;
      j = 0;
      if (j < i)
        break;
      localStringBuilder.append("\n");
      Log.d("Su.UpdaterFragment", localStringBuilder.toString());
      paramDataOutputStream.writeBytes(localStringBuilder.toString());
      if (paramBufferedReader == null)
        continue;
      k = 0;
    }
    while (true)
    {
      if (k >= paramInt)
      {
        label77: if (!paramBufferedReader.ready())
          break label9;
        str = paramBufferedReader.readLine();
        break label9;
        localStringBuilder.append(paramArrayOfString[j]).append(" ");
        j++;
        break label29;
      }
      if (paramBufferedReader.ready())
        break;
      try
      {
        Thread.sleep(5L);
        k++;
      }
      catch (InterruptedException localInterruptedException)
      {
        while (true)
          Log.w("Su.UpdaterFragment", "Sleep timer interrupted", localInterruptedException);
      }
    }
  }

  private String executeCommand(DataOutputStream paramDataOutputStream, BufferedReader paramBufferedReader, String[] paramArrayOfString)
    throws IOException
  {
    return executeCommand(paramDataOutputStream, paramBufferedReader, 200, paramArrayOfString);
  }

  private boolean findBusybox()
  {
    int i = 0;
    String[] arrayOfString = System.getenv("PATH").split(":");
    int j = arrayOfString.length;
    for (int k = 0; ; k++)
    {
      if (k >= j);
      while (true)
      {
        return i;
        File localFile = new File(arrayOfString[k], "busybox");
        if (!localFile.exists())
          break;
        this.mBusyboxPath = localFile.getAbsolutePath();
        i = 1;
      }
    }
  }

  private boolean verifyFile(String paramString1, String paramString2)
  {
    int i = 0;
    if (this.mBusyboxPath == null)
    {
      Log.e("Su.UpdaterFragment", "Busybox not present");
      return i;
    }
    label259: label264: 
    while (true)
    {
      BufferedReader localBufferedReader1;
      int j;
      try
      {
        Runtime localRuntime = Runtime.getRuntime();
        String[] arrayOfString = new String[3];
        arrayOfString[0] = this.mBusyboxPath;
        arrayOfString[1] = "md5sum";
        arrayOfString[2] = paramString1;
        Process localProcess = localRuntime.exec(arrayOfString);
        localBufferedReader1 = new BufferedReader(new InputStreamReader(new DataInputStream(localProcess.getInputStream())), 64);
        BufferedReader localBufferedReader2 = new BufferedReader(new InputStreamReader(new DataInputStream(localProcess.getErrorStream())), 64);
        j = 0;
        break label264;
        label126: if (!localBufferedReader2.ready())
          continue;
        Log.d("Su.UpdaterFragment", localBufferedReader2.readLine());
        if (!localBufferedReader1.ready())
          break label247;
        String str = localBufferedReader1.readLine();
        localProcess.destroy();
        if (str.split(" ")[0].equals(paramString2))
          break label259;
        Log.e("Su.UpdaterFragment", "Checksum mismatch");
      }
      catch (IOException localIOException)
      {
        Log.e("Su.UpdaterFragment", "Checking of md5sum failed", localIOException);
      }
      break;
      label247: 
      do
      {
        boolean bool = localBufferedReader1.ready();
        if (bool)
          break label126;
        try
        {
          Thread.sleep(5L);
          j++;
        }
        catch (InterruptedException localInterruptedException)
        {
          while (true)
            Log.w("Su.UpdaterFragment", "Sleep timer got interrupted...");
        }
        Log.e("Su.UpdaterFragment", "Could not check md5sum");
        break;
        i = 1;
        break;
      }
      while (j < 200);
    }
  }

  private String whichSu()
  {
    String[] arrayOfString = System.getenv("PATH").split(":");
    int i = arrayOfString.length;
    for (int j = 0; ; j++)
    {
      Object localObject;
      if (j >= i)
        localObject = null;
      while (true)
      {
        return localObject;
        File localFile = new File(arrayOfString[j] + "/su");
        if ((!localFile.exists()) || (!localFile.isFile()))
          break;
        try
        {
          if (!localFile.getAbsolutePath().equals(localFile.getCanonicalPath()))
            break;
          String str = localFile.getAbsolutePath();
          localObject = str;
        }
        catch (IOException localIOException)
        {
          Log.w("Su.UpdaterFragment", "IOException while finding canonical path of " + localFile.getAbsolutePath(), localIOException);
        }
      }
    }
  }

  public ConsoleAdapter getListAdapter()
  {
    return (ConsoleAdapter)super.getListAdapter();
  }

  public void onActivityCreated(Bundle paramBundle)
  {
    super.onActivityCreated(paramBundle);
    setListAdapter(new ConsoleAdapter(getActivity()));
    this.mProgressBar.setInterpolator(getActivity(), 17432580);
    this.mUpdateTask = new UpdateTask(null);
    this.mUpdateTask.execute(new Void[0]);
  }

  public void onClick(View paramView)
  {
    this.mUpdateTask = new UpdateTask(null);
    this.mUpdateTask.execute(new Void[0]);
  }

  public View onCreateView(LayoutInflater paramLayoutInflater, ViewGroup paramViewGroup, Bundle paramBundle)
  {
    if (Integer.parseInt(Build.VERSION.SDK) < 5);
    for (int i = 2131427471; ; i = 2131427472)
    {
      this.MANIFEST_URL = getString(i);
      this.CONSOLE_GREY = getActivity().getResources().getColor(2131230726);
      this.CONSOLE_RED = getActivity().getResources().getColor(2131230727);
      this.CONSOLE_GREEN = getActivity().getResources().getColor(2131230728);
      View localView = paramLayoutInflater.inflate(2130903053, paramViewGroup, false);
      ((TextView)localView.findViewById(2131361794)).setText(2131427464);
      this.mTitleProgress = ((ProgressBar)localView.findViewById(2131361808));
      this.mProgressBar = ((ProgressBar)localView.findViewById(2131361845));
      this.mStatusText = ((TextView)localView.findViewById(2131361832));
      this.mActionButton = ((Button)localView.findViewById(2131361846));
      this.mActionButton.setOnClickListener(this);
      return localView;
    }
  }

  public void onStop()
  {
    super.onStop();
    if (this.mUpdateTask != null)
      this.mUpdateTask.cancel(false);
  }

  private class ConsoleAdapter extends ArrayAdapter<UpdaterFragment.ConsoleEntry>
  {
    ConsoleAdapter(Context arg2)
    {
      super(2130903048);
    }

    public View getView(int paramInt, View paramView, ViewGroup paramViewGroup)
    {
      TextView localTextView = (TextView)super.getView(paramInt, paramView, paramViewGroup);
      UpdaterFragment.ConsoleEntry localConsoleEntry = (UpdaterFragment.ConsoleEntry)getItem(paramInt);
      ((Spannable)localTextView.getText()).setSpan(new ForegroundColorSpan(localConsoleEntry.statusColor), localConsoleEntry.entry.length(), localConsoleEntry.toString().length(), 33);
      return localTextView;
    }
  }

  private class ConsoleEntry
  {
    public String entry;
    public String status = "";
    public int statusColor = UpdaterFragment.this.CONSOLE_GREY;

    public ConsoleEntry(int arg2)
    {
      int i;
      this.entry = UpdaterFragment.this.getActivity().getString(i);
    }

    public String toString()
    {
      return this.entry + this.status;
    }
  }

  private class Manifest
  {
    public String binaryMd5;
    public String binaryUrl;
    public String busyboxMd5;
    public String busyboxUrl;
    public String version;
    public int versionCode;

    private Manifest()
    {
    }

    public boolean populate(JSONObject paramJSONObject)
    {
      int i = 0;
      try
      {
        this.version = paramJSONObject.getString("version");
        this.versionCode = paramJSONObject.getInt("version-code");
        this.binaryUrl = paramJSONObject.getString("binary");
        this.binaryMd5 = paramJSONObject.getString("binary-md5sum");
        this.busyboxUrl = paramJSONObject.getString("busybox");
        this.busyboxMd5 = paramJSONObject.getString("busybox-md5sum");
        if ((this.version == null) || (this.versionCode == 0) || (this.binaryUrl == null) || (this.binaryMd5 == null) || (this.busyboxUrl == null) || (this.busyboxMd5 == null))
          return i;
      }
      catch (JSONException localJSONException)
      {
        while (true)
        {
          continue;
          i = 1;
        }
      }
    }
  }

  private static enum Step
  {
    static
    {
      DOWNLOAD_BUSYBOX = new Step("DOWNLOAD_BUSYBOX", 1);
      Step[] arrayOfStep = new Step[2];
      arrayOfStep[0] = DOWNLOAD_MANIFEST;
      arrayOfStep[1] = DOWNLOAD_BUSYBOX;
      ENUM$VALUES = arrayOfStep;
    }
  }

  private class UpdateTask extends AsyncTask<Void, Object, Integer>
  {
    public static final int STATUS_AWAITING_ACTION = 1;
    public static final int STATUS_CANCELLED = 8;
    public static final int STATUS_CONN_FAILED = 5;
    public static final int STATUS_FINISHED_FAIL = 3;
    public static final int STATUS_FINISHED_FAIL_REMOUNT = 2131427501;
    public static final int STATUS_FINISHED_FAIL_SBIN = 2131427500;
    public static final int STATUS_FINISHED_NO_NEED = 4;
    public static final int STATUS_FINISHED_SUCCESSFUL = 2;

    private UpdateTask()
    {
    }

    // ERROR //
    private boolean downloadFile(String paramString1, String paramString2)
    {
      // Byte code:
      //   0: iconst_0
      //   1: istore_3
      //   2: new 75	java/io/BufferedInputStream
      //   5: dup
      //   6: new 77	java/net/URL
      //   9: dup
      //   10: aload_1
      //   11: invokespecial 80	java/net/URL:<init>	(Ljava/lang/String;)V
      //   14: invokevirtual 84	java/net/URL:openConnection	()Ljava/net/URLConnection;
      //   17: invokevirtual 90	java/net/URLConnection:getInputStream	()Ljava/io/InputStream;
      //   20: invokespecial 93	java/io/BufferedInputStream:<init>	(Ljava/io/InputStream;)V
      //   23: astore 4
      //   25: new 95	org/apache/http/util/ByteArrayBuffer
      //   28: dup
      //   29: bipush 50
      //   31: invokespecial 98	org/apache/http/util/ByteArrayBuffer:<init>	(I)V
      //   34: astore 5
      //   36: aload 4
      //   38: invokevirtual 101	java/io/BufferedInputStream:read	()I
      //   41: istore 10
      //   43: iload 10
      //   45: bipush 255
      //   47: if_icmpne +18 -> 65
      //   50: aload 4
      //   52: invokevirtual 104	java/io/BufferedInputStream:close	()V
      //   55: aload_0
      //   56: invokevirtual 108	com/noshufou/android/su/UpdaterFragment$UpdateTask:isCancelled	()Z
      //   59: ifeq +24 -> 83
      //   62: goto +241 -> 303
      //   65: aload 5
      //   67: iload 10
      //   69: i2b
      //   70: invokevirtual 111	org/apache/http/util/ByteArrayBuffer:append	(I)V
      //   73: aload_0
      //   74: invokevirtual 108	com/noshufou/android/su/UpdaterFragment$UpdateTask:isCancelled	()Z
      //   77: ifeq -41 -> 36
      //   80: goto +223 -> 303
      //   83: aload_2
      //   84: ldc 113
      //   86: invokevirtual 119	java/lang/String:equals	(Ljava/lang/Object;)Z
      //   89: istore 11
      //   91: iload 11
      //   93: ifeq +74 -> 167
      //   96: aload_0
      //   97: getfield 57	com/noshufou/android/su/UpdaterFragment$UpdateTask:this$0	Lcom/noshufou/android/su/UpdaterFragment;
      //   100: new 121	com/noshufou/android/su/UpdaterFragment$Manifest
      //   103: dup
      //   104: aload_0
      //   105: getfield 57	com/noshufou/android/su/UpdaterFragment$UpdateTask:this$0	Lcom/noshufou/android/su/UpdaterFragment;
      //   108: aconst_null
      //   109: invokespecial 124	com/noshufou/android/su/UpdaterFragment$Manifest:<init>	(Lcom/noshufou/android/su/UpdaterFragment;Lcom/noshufou/android/su/UpdaterFragment$Manifest;)V
      //   112: invokestatic 127	com/noshufou/android/su/UpdaterFragment:access$20	(Lcom/noshufou/android/su/UpdaterFragment;Lcom/noshufou/android/su/UpdaterFragment$Manifest;)V
      //   115: aload_0
      //   116: getfield 57	com/noshufou/android/su/UpdaterFragment$UpdateTask:this$0	Lcom/noshufou/android/su/UpdaterFragment;
      //   119: invokestatic 131	com/noshufou/android/su/UpdaterFragment:access$8	(Lcom/noshufou/android/su/UpdaterFragment;)Lcom/noshufou/android/su/UpdaterFragment$Manifest;
      //   122: new 133	org/json/JSONObject
      //   125: dup
      //   126: new 115	java/lang/String
      //   129: dup
      //   130: aload 5
      //   132: invokevirtual 137	org/apache/http/util/ByteArrayBuffer:toByteArray	()[B
      //   135: invokespecial 140	java/lang/String:<init>	([B)V
      //   138: invokespecial 141	org/json/JSONObject:<init>	(Ljava/lang/String;)V
      //   141: invokevirtual 145	com/noshufou/android/su/UpdaterFragment$Manifest:populate	(Lorg/json/JSONObject;)Z
      //   144: istore 15
      //   146: iload 15
      //   148: istore_3
      //   149: goto +154 -> 303
      //   152: astore 13
      //   154: ldc 147
      //   156: ldc 149
      //   158: aload 13
      //   160: invokestatic 155	android/util/Log:e	(Ljava/lang/String;Ljava/lang/String;Ljava/lang/Throwable;)I
      //   163: pop
      //   164: goto +139 -> 303
      //   167: aload_0
      //   168: getfield 57	com/noshufou/android/su/UpdaterFragment$UpdateTask:this$0	Lcom/noshufou/android/su/UpdaterFragment;
      //   171: invokevirtual 159	com/noshufou/android/su/UpdaterFragment:getActivity	()Landroid/support/v4/app/FragmentActivity;
      //   174: aload_2
      //   175: iconst_0
      //   176: invokevirtual 165	android/support/v4/app/FragmentActivity:openFileOutput	(Ljava/lang/String;I)Ljava/io/FileOutputStream;
      //   179: astore 12
      //   181: aload 12
      //   183: aload 5
      //   185: invokevirtual 137	org/apache/http/util/ByteArrayBuffer:toByteArray	()[B
      //   188: invokevirtual 170	java/io/FileOutputStream:write	([B)V
      //   191: aload 12
      //   193: invokevirtual 171	java/io/FileOutputStream:close	()V
      //   196: aload_2
      //   197: ldc 173
      //   199: invokevirtual 119	java/lang/String:equals	(Ljava/lang/Object;)Z
      //   202: ifeq +28 -> 230
      //   205: aload_0
      //   206: getfield 57	com/noshufou/android/su/UpdaterFragment$UpdateTask:this$0	Lcom/noshufou/android/su/UpdaterFragment;
      //   209: aload_0
      //   210: getfield 57	com/noshufou/android/su/UpdaterFragment$UpdateTask:this$0	Lcom/noshufou/android/su/UpdaterFragment;
      //   213: invokevirtual 159	com/noshufou/android/su/UpdaterFragment:getActivity	()Landroid/support/v4/app/FragmentActivity;
      //   216: invokevirtual 177	android/support/v4/app/FragmentActivity:getFilesDir	()Ljava/io/File;
      //   219: invokevirtual 183	java/io/File:getAbsolutePath	()Ljava/lang/String;
      //   222: ldc 185
      //   224: invokevirtual 189	java/lang/String:concat	(Ljava/lang/String;)Ljava/lang/String;
      //   227: invokestatic 193	com/noshufou/android/su/UpdaterFragment:access$21	(Lcom/noshufou/android/su/UpdaterFragment;Ljava/lang/String;)V
      //   230: iconst_1
      //   231: istore_3
      //   232: goto +71 -> 303
      //   235: astore 6
      //   237: ldc 147
      //   239: new 195	java/lang/StringBuilder
      //   242: dup
      //   243: ldc 197
      //   245: invokespecial 198	java/lang/StringBuilder:<init>	(Ljava/lang/String;)V
      //   248: aload_1
      //   249: invokevirtual 201	java/lang/StringBuilder:append	(Ljava/lang/String;)Ljava/lang/StringBuilder;
      //   252: invokevirtual 204	java/lang/StringBuilder:toString	()Ljava/lang/String;
      //   255: aload 6
      //   257: invokestatic 155	android/util/Log:e	(Ljava/lang/String;Ljava/lang/String;Ljava/lang/Throwable;)I
      //   260: pop
      //   261: goto +42 -> 303
      //   264: astore 8
      //   266: ldc 147
      //   268: new 195	java/lang/StringBuilder
      //   271: dup
      //   272: ldc 206
      //   274: invokespecial 198	java/lang/StringBuilder:<init>	(Ljava/lang/String;)V
      //   277: aload_2
      //   278: invokevirtual 201	java/lang/StringBuilder:append	(Ljava/lang/String;)Ljava/lang/StringBuilder;
      //   281: invokevirtual 204	java/lang/StringBuilder:toString	()Ljava/lang/String;
      //   284: aload 8
      //   286: invokestatic 155	android/util/Log:e	(Ljava/lang/String;Ljava/lang/String;Ljava/lang/Throwable;)I
      //   289: pop
      //   290: goto +13 -> 303
      //   293: astore 8
      //   295: goto -29 -> 266
      //   298: astore 6
      //   300: goto -63 -> 237
      //   303: iload_3
      //   304: ireturn
      //
      // Exception table:
      //   from	to	target	type
      //   96	146	152	org/json/JSONException
      //   2	25	235	java/net/MalformedURLException
      //   2	25	264	java/io/IOException
      //   25	91	293	java/io/IOException
      //   96	146	293	java/io/IOException
      //   154	230	293	java/io/IOException
      //   25	91	298	java/net/MalformedURLException
      //   96	146	298	java/net/MalformedURLException
      //   154	230	298	java/net/MalformedURLException
    }

    protected Integer doInBackground(Void[] paramArrayOfVoid)
    {
      Object localObject1;
      switch ($SWITCH_TABLE$com$noshufou$android$su$UpdaterFragment$Step()[UpdaterFragment.this.mCurrentStep.ordinal()])
      {
      default:
        localObject1 = Integer.valueOf(-1);
      case 1:
      case 2:
      }
      while (true)
      {
        return localObject1;
        if (isCancelled())
        {
          localObject1 = Integer.valueOf(8);
          continue;
        }
        int i7 = 0 + 1;
        Object[] arrayOfObject57 = new Object[4];
        arrayOfObject57[0] = Integer.valueOf(4);
        arrayOfObject57[1] = Integer.valueOf(0);
        arrayOfObject57[2] = Integer.valueOf(i7);
        arrayOfObject57[3] = Integer.valueOf(2131427480);
        publishProgress(arrayOfObject57);
        if (downloadFile(UpdaterFragment.this.MANIFEST_URL, "manifest"))
        {
          Object[] arrayOfObject59 = new Object[5];
          arrayOfObject59[0] = Integer.valueOf(4);
          arrayOfObject59[1] = Integer.valueOf(i7);
          arrayOfObject59[2] = Integer.valueOf(i7);
          arrayOfObject59[3] = Integer.valueOf(2131427473);
          arrayOfObject59[4] = Integer.valueOf(UpdaterFragment.access$6(UpdaterFragment.this));
          publishProgress(arrayOfObject59);
          if (isCancelled())
          {
            localObject1 = Integer.valueOf(8);
            continue;
          }
        }
        else
        {
          Object[] arrayOfObject58 = new Object[5];
          arrayOfObject58[0] = Integer.valueOf(4);
          arrayOfObject58[1] = Integer.valueOf(0);
          arrayOfObject58[2] = Integer.valueOf(i7);
          arrayOfObject58[3] = Integer.valueOf(2131427474);
          arrayOfObject58[4] = Integer.valueOf(UpdaterFragment.access$7(UpdaterFragment.this));
          publishProgress(arrayOfObject58);
          localObject1 = Integer.valueOf(5);
          continue;
        }
        int i8 = i7 + 1;
        Object[] arrayOfObject60 = new Object[4];
        arrayOfObject60[0] = Integer.valueOf(4);
        arrayOfObject60[1] = Integer.valueOf(1);
        arrayOfObject60[2] = Integer.valueOf(i8);
        arrayOfObject60[3] = Integer.valueOf(2131427481);
        publishProgress(arrayOfObject60);
        if (UpdaterFragment.this.mManifest == null)
        {
          Object[] arrayOfObject68 = new Object[5];
          arrayOfObject68[0] = Integer.valueOf(4);
          arrayOfObject68[1] = Integer.valueOf(1);
          arrayOfObject68[2] = Integer.valueOf(i8);
          arrayOfObject68[3] = Integer.valueOf(2131427474);
          arrayOfObject68[4] = Integer.valueOf(UpdaterFragment.access$7(UpdaterFragment.this));
          publishProgress(arrayOfObject68);
          localObject1 = Integer.valueOf(3);
          continue;
        }
        Object[] arrayOfObject61 = new Object[5];
        arrayOfObject61[0] = Integer.valueOf(4);
        arrayOfObject61[1] = Integer.valueOf(i8);
        arrayOfObject61[2] = Integer.valueOf(i8);
        arrayOfObject61[3] = Integer.valueOf(2131427473);
        arrayOfObject61[4] = Integer.valueOf(UpdaterFragment.access$6(UpdaterFragment.this));
        publishProgress(arrayOfObject61);
        if (isCancelled())
        {
          localObject1 = Integer.valueOf(8);
          continue;
        }
        int i9 = i8 + 1;
        Object[] arrayOfObject62 = new Object[4];
        arrayOfObject62[0] = Integer.valueOf(4);
        arrayOfObject62[1] = Integer.valueOf(2);
        arrayOfObject62[2] = Integer.valueOf(i9);
        arrayOfObject62[3] = Integer.valueOf(2131427482);
        publishProgress(arrayOfObject62);
        if (UpdaterFragment.this.mManifest.version != null)
        {
          Object[] arrayOfObject67 = new Object[5];
          arrayOfObject67[0] = Integer.valueOf(4);
          arrayOfObject67[1] = Integer.valueOf(i9);
          arrayOfObject67[2] = Integer.valueOf(i9);
          arrayOfObject67[3] = UpdaterFragment.access$8(UpdaterFragment.this).version;
          arrayOfObject67[4] = Integer.valueOf(UpdaterFragment.access$6(UpdaterFragment.this));
          publishProgress(arrayOfObject67);
        }
        while (true)
        {
          if (!isCancelled())
            break label697;
          localObject1 = Integer.valueOf(8);
          break;
          Object[] arrayOfObject63 = new Object[5];
          arrayOfObject63[0] = Integer.valueOf(4);
          arrayOfObject63[1] = Integer.valueOf(2);
          arrayOfObject63[2] = Integer.valueOf(i9);
          arrayOfObject63[3] = Integer.valueOf(2131427474);
          arrayOfObject63[4] = Integer.valueOf(UpdaterFragment.access$7(UpdaterFragment.this));
          publishProgress(arrayOfObject63);
        }
        label697: int i10 = i9 + 1;
        Object[] arrayOfObject64 = new Object[4];
        arrayOfObject64[0] = Integer.valueOf(4);
        arrayOfObject64[1] = Integer.valueOf(3);
        arrayOfObject64[2] = Integer.valueOf(i10);
        arrayOfObject64[3] = Integer.valueOf(2131427483);
        publishProgress(arrayOfObject64);
        int i11 = Util.getSuVersionCode();
        String str12 = Util.getSuVersion();
        if (str12 == null)
          str12 = "legacy";
        if (i11 < UpdaterFragment.this.mManifest.versionCode)
        {
          Object[] arrayOfObject66 = new Object[5];
          arrayOfObject66[0] = Integer.valueOf(4);
          arrayOfObject66[1] = Integer.valueOf(i10);
          arrayOfObject66[2] = Integer.valueOf(i10);
          arrayOfObject66[3] = str12;
          arrayOfObject66[4] = Integer.valueOf(UpdaterFragment.access$7(UpdaterFragment.this));
          publishProgress(arrayOfObject66);
          UpdaterFragment.this.mCurrentStep = UpdaterFragment.Step.DOWNLOAD_BUSYBOX;
          localObject1 = Integer.valueOf(1);
          continue;
        }
        Object[] arrayOfObject65 = new Object[5];
        arrayOfObject65[0] = Integer.valueOf(4);
        arrayOfObject65[1] = Integer.valueOf(i10);
        arrayOfObject65[2] = Integer.valueOf(i10);
        arrayOfObject65[3] = str12;
        arrayOfObject65[4] = Integer.valueOf(UpdaterFragment.access$6(UpdaterFragment.this));
        publishProgress(arrayOfObject65);
        UpdaterFragment.this.mCurrentStep = UpdaterFragment.Step.DOWNLOAD_BUSYBOX;
        localObject1 = Integer.valueOf(4);
        continue;
        if (Util.getSuVersionCode() == 0);
        int j;
        for (int i = 1; ; i = 0)
        {
          if (i == 0)
            break label1268;
          j = 14;
          if (!isCancelled())
            break label975;
          localObject1 = Integer.valueOf(8);
          break;
        }
        label975: int k = 1;
        Object[] arrayOfObject54 = new Object[4];
        arrayOfObject54[0] = Integer.valueOf(j);
        arrayOfObject54[1] = Integer.valueOf(0);
        arrayOfObject54[2] = Integer.valueOf(k);
        arrayOfObject54[3] = Integer.valueOf(2131427484);
        publishProgress(arrayOfObject54);
        SQLiteDatabase localSQLiteDatabase = null;
        while (true)
        {
          try
          {
            localSQLiteDatabase = UpdaterFragment.this.getActivity().openOrCreateDatabase("permissions.sqlite", 0, null);
            localSQLiteDatabase.execSQL("CREATE TABLE IF NOT EXISTS apps (_id INTEGER, uid INTEGER, package TEXT, name TEXT, exec_uid INTEGER, exec_cmd TEXT,  allow INTEGER, PRIMARY KEY (_id), UNIQUE (uid,exec_uid,exec_cmd))");
            localSQLiteDatabase.execSQL("CREATE TABLE IF NOT EXISTS logs (_id INTEGER, app_id INTEGER, date INTEGER, type INTEGER, PRIMARY KEY (_id))");
            localSQLiteDatabase.execSQL("CREATE TABLE IF NOT EXISTS prefs (_id INTEGER, key TEXT, value TEXT, PRIMARY KEY (_id))");
            if (localSQLiteDatabase == null)
              continue;
            localSQLiteDatabase.close();
            Object[] arrayOfObject56 = new Object[5];
            arrayOfObject56[0] = Integer.valueOf(j);
            arrayOfObject56[1] = Integer.valueOf(k);
            arrayOfObject56[2] = Integer.valueOf(k);
            arrayOfObject56[3] = Integer.valueOf(2131427473);
            arrayOfObject56[4] = Integer.valueOf(UpdaterFragment.access$6(UpdaterFragment.this));
            publishProgress(arrayOfObject56);
            if (!isCancelled())
              break label1277;
            localObject1 = Integer.valueOf(8);
            break;
          }
          catch (SQLException localSQLException)
          {
            Log.e("Su.UpdaterFragment", "Failed to fix database", localSQLException);
            Object[] arrayOfObject55 = new Object[5];
            arrayOfObject55[0] = Integer.valueOf(j);
            arrayOfObject55[1] = Integer.valueOf(0);
            arrayOfObject55[2] = Integer.valueOf(k);
            arrayOfObject55[3] = Integer.valueOf(2131427474);
            arrayOfObject55[4] = Integer.valueOf(UpdaterFragment.access$7(UpdaterFragment.this));
            publishProgress(arrayOfObject55);
            Integer localInteger3 = Integer.valueOf(3);
            localObject1 = localInteger3;
            if (localSQLiteDatabase == null)
              break;
            localSQLiteDatabase.close();
            break;
          }
          finally
          {
            if (localSQLiteDatabase == null)
              continue;
            localSQLiteDatabase.close();
          }
          label1268: j = 13;
          k = 0;
        }
        label1277: Object[] arrayOfObject1 = new Object[4];
        arrayOfObject1[0] = Integer.valueOf(j);
        arrayOfObject1[1] = Integer.valueOf(k - 1);
        arrayOfObject1[2] = Integer.valueOf(k);
        arrayOfObject1[3] = Integer.valueOf(2131427485);
        publishProgress(arrayOfObject1);
        if (UpdaterFragment.this.findBusybox())
        {
          Object[] arrayOfObject53 = new Object[5];
          arrayOfObject53[0] = Integer.valueOf(j);
          arrayOfObject53[1] = Integer.valueOf(k);
          arrayOfObject53[2] = Integer.valueOf(k);
          arrayOfObject53[3] = Integer.valueOf(2131427473);
          arrayOfObject53[4] = Integer.valueOf(UpdaterFragment.access$6(UpdaterFragment.this));
          publishProgress(arrayOfObject53);
        }
        while (true)
        {
          int m;
          while (true)
          {
            if (!isCancelled())
              break label2137;
            localObject1 = Integer.valueOf(8);
            break;
            Object[] arrayOfObject2 = new Object[5];
            arrayOfObject2[0] = Integer.valueOf(j);
            arrayOfObject2[1] = Integer.valueOf(k);
            arrayOfObject2[2] = Integer.valueOf(k);
            arrayOfObject2[3] = Integer.valueOf(2131427475);
            arrayOfObject2[4] = Integer.valueOf(UpdaterFragment.access$7(UpdaterFragment.this));
            publishProgress(arrayOfObject2);
            j += 2;
            if (isCancelled())
            {
              localObject1 = Integer.valueOf(8);
              break;
            }
            m = k + 1;
            Object[] arrayOfObject3 = new Object[4];
            arrayOfObject3[0] = Integer.valueOf(j);
            arrayOfObject3[1] = Integer.valueOf(m - 1);
            arrayOfObject3[2] = Integer.valueOf(m);
            arrayOfObject3[3] = Integer.valueOf(2131427486);
            publishProgress(arrayOfObject3);
            if (downloadFile(UpdaterFragment.this.mManifest.busyboxUrl, "busybox"))
              try
              {
                ProcessBuilder localProcessBuilder = new ProcessBuilder(new String[0]);
                String[] arrayOfString11 = new String[3];
                arrayOfString11[0] = "chmod";
                arrayOfString11[1] = "755";
                arrayOfString11[2] = UpdaterFragment.access$11(UpdaterFragment.this);
                Process localProcess2 = localProcessBuilder.command(arrayOfString11).redirectErrorStream(true).start();
                Log.d("Su.UpdaterFragment", "chmod 755 " + UpdaterFragment.this.mBusyboxPath);
                localProcess2.waitFor();
                localProcess2.destroy();
                Object[] arrayOfObject5 = new Object[5];
                arrayOfObject5[0] = Integer.valueOf(j);
                arrayOfObject5[1] = Integer.valueOf(m);
                arrayOfObject5[2] = Integer.valueOf(m);
                arrayOfObject5[3] = Integer.valueOf(2131427473);
                arrayOfObject5[4] = Integer.valueOf(UpdaterFragment.access$6(UpdaterFragment.this));
                publishProgress(arrayOfObject5);
                if (!isCancelled())
                  break label1918;
                localObject1 = Integer.valueOf(8);
              }
              catch (IOException localIOException2)
              {
                Log.e("Su.UpdaterFragment", "Failed to set busybox to executable", localIOException2);
                Object[] arrayOfObject52 = new Object[5];
                arrayOfObject52[0] = Integer.valueOf(j);
                arrayOfObject52[1] = Integer.valueOf(m - 1);
                arrayOfObject52[2] = Integer.valueOf(m);
                arrayOfObject52[3] = Integer.valueOf(2131427474);
                arrayOfObject52[4] = Integer.valueOf(UpdaterFragment.access$7(UpdaterFragment.this));
                publishProgress(arrayOfObject52);
                localObject1 = Integer.valueOf(3);
              }
              catch (InterruptedException localInterruptedException)
              {
                while (true)
                  Log.w("Su.UpdaterFragment", "Process interrupted", localInterruptedException);
              }
          }
          Log.e("Su.UpdaterFragment", "Failed to download busybox");
          Object[] arrayOfObject4 = new Object[4];
          arrayOfObject4[0] = Integer.valueOf(j);
          arrayOfObject4[1] = Integer.valueOf(m - 1);
          arrayOfObject4[2] = Integer.valueOf(m);
          arrayOfObject4[3] = Integer.valueOf(2131427474);
          publishProgress(arrayOfObject4);
          localObject1 = Integer.valueOf(3);
          break;
          label1918: k = m + 1;
          Object[] arrayOfObject6 = new Object[4];
          arrayOfObject6[0] = Integer.valueOf(j);
          arrayOfObject6[1] = Integer.valueOf(k - 1);
          arrayOfObject6[2] = Integer.valueOf(k);
          arrayOfObject6[3] = Integer.valueOf(2131427487);
          publishProgress(arrayOfObject6);
          if (!UpdaterFragment.this.verifyFile(UpdaterFragment.this.mBusyboxPath, UpdaterFragment.this.mManifest.busyboxMd5))
            break label2065;
          Object[] arrayOfObject8 = new Object[5];
          arrayOfObject8[0] = Integer.valueOf(j);
          arrayOfObject8[1] = Integer.valueOf(k);
          arrayOfObject8[2] = Integer.valueOf(k);
          arrayOfObject8[3] = Integer.valueOf(2131427473);
          arrayOfObject8[4] = Integer.valueOf(UpdaterFragment.access$6(UpdaterFragment.this));
          publishProgress(arrayOfObject8);
        }
        label2065: Object[] arrayOfObject7 = new Object[5];
        arrayOfObject7[0] = Integer.valueOf(j);
        arrayOfObject7[1] = Integer.valueOf(k - 1);
        arrayOfObject7[2] = Integer.valueOf(k);
        arrayOfObject7[3] = Integer.valueOf(2131427474);
        arrayOfObject7[4] = Integer.valueOf(UpdaterFragment.access$7(UpdaterFragment.this));
        publishProgress(arrayOfObject7);
        localObject1 = Integer.valueOf(3);
        continue;
        label2137: int n = k + 1;
        Object[] arrayOfObject9 = new Object[4];
        arrayOfObject9[0] = Integer.valueOf(j);
        arrayOfObject9[1] = Integer.valueOf(n - 1);
        arrayOfObject9[2] = Integer.valueOf(n);
        arrayOfObject9[3] = Integer.valueOf(2131427488);
        publishProgress(arrayOfObject9);
        String str1 = UpdaterFragment.this.whichSu();
        Log.d("Su.UpdaterFragment", "su installed to " + str1);
        if (str1 == null)
        {
          Object[] arrayOfObject50 = new Object[5];
          arrayOfObject50[0] = Integer.valueOf(j);
          arrayOfObject50[1] = Integer.valueOf(n - 1);
          arrayOfObject50[2] = Integer.valueOf(n);
          arrayOfObject50[3] = Integer.valueOf(2131427474);
          arrayOfObject50[4] = Integer.valueOf(UpdaterFragment.access$7(UpdaterFragment.this));
          publishProgress(arrayOfObject50);
          Object[] arrayOfObject51 = new Object[4];
          arrayOfObject51[0] = Integer.valueOf(j);
          arrayOfObject51[1] = Integer.valueOf(n - 1);
          arrayOfObject51[2] = Integer.valueOf(n);
          arrayOfObject51[3] = Integer.valueOf(2131427498);
          publishProgress(arrayOfObject51);
          localObject1 = Integer.valueOf(3);
          continue;
        }
        if (str1.equals("/sbin/su"))
        {
          Object[] arrayOfObject48 = new Object[5];
          arrayOfObject48[0] = Integer.valueOf(j);
          arrayOfObject48[1] = Integer.valueOf(n - 1);
          arrayOfObject48[2] = Integer.valueOf(n);
          arrayOfObject48[3] = str1;
          arrayOfObject48[4] = Integer.valueOf(UpdaterFragment.access$7(UpdaterFragment.this));
          publishProgress(arrayOfObject48);
          Object[] arrayOfObject49 = new Object[4];
          arrayOfObject49[0] = Integer.valueOf(j);
          arrayOfObject49[1] = Integer.valueOf(n - 1);
          arrayOfObject49[2] = Integer.valueOf(n);
          arrayOfObject49[3] = Integer.valueOf(2131427499);
          publishProgress(arrayOfObject49);
          localObject1 = Integer.valueOf(2131427500);
          continue;
        }
        Object[] arrayOfObject10 = new Object[5];
        arrayOfObject10[0] = Integer.valueOf(j);
        arrayOfObject10[1] = Integer.valueOf(n);
        arrayOfObject10[2] = Integer.valueOf(n);
        arrayOfObject10[3] = str1;
        arrayOfObject10[4] = Integer.valueOf(UpdaterFragment.access$6(UpdaterFragment.this));
        publishProgress(arrayOfObject10);
        if (isCancelled())
        {
          localObject1 = Integer.valueOf(8);
          continue;
        }
        int i1 = n + 1;
        Object[] arrayOfObject11 = new Object[4];
        arrayOfObject11[0] = Integer.valueOf(j);
        arrayOfObject11[1] = Integer.valueOf(i1 - 1);
        arrayOfObject11[2] = Integer.valueOf(i1);
        arrayOfObject11[3] = Integer.valueOf(2131427489);
        publishProgress(arrayOfObject11);
        String str2;
        if (downloadFile(UpdaterFragment.this.mManifest.binaryUrl, "su"))
        {
          str2 = UpdaterFragment.this.getActivity().getFileStreamPath("su").toString();
          Object[] arrayOfObject13 = new Object[5];
          arrayOfObject13[0] = Integer.valueOf(j);
          arrayOfObject13[1] = Integer.valueOf(i1);
          arrayOfObject13[2] = Integer.valueOf(i1);
          arrayOfObject13[3] = Integer.valueOf(2131427473);
          arrayOfObject13[4] = Integer.valueOf(UpdaterFragment.access$6(UpdaterFragment.this));
          publishProgress(arrayOfObject13);
          if (isCancelled())
          {
            localObject1 = Integer.valueOf(8);
            continue;
          }
        }
        else
        {
          Object[] arrayOfObject12 = new Object[5];
          arrayOfObject12[0] = Integer.valueOf(j);
          arrayOfObject12[1] = Integer.valueOf(i1 - 1);
          arrayOfObject12[2] = Integer.valueOf(i1);
          arrayOfObject12[3] = Integer.valueOf(2131427474);
          arrayOfObject12[4] = Integer.valueOf(UpdaterFragment.access$7(UpdaterFragment.this));
          publishProgress(arrayOfObject12);
          localObject1 = Integer.valueOf(3);
          continue;
        }
        int i2 = i1 + 1;
        Object[] arrayOfObject14 = new Object[4];
        arrayOfObject14[0] = Integer.valueOf(j);
        arrayOfObject14[1] = Integer.valueOf(i2 - 1);
        arrayOfObject14[2] = Integer.valueOf(i2);
        arrayOfObject14[3] = Integer.valueOf(2131427487);
        publishProgress(arrayOfObject14);
        Process localProcess1;
        int i3;
        if (UpdaterFragment.this.verifyFile(str2, UpdaterFragment.this.mManifest.binaryMd5))
        {
          Object[] arrayOfObject16 = new Object[5];
          arrayOfObject16[0] = Integer.valueOf(j);
          arrayOfObject16[1] = Integer.valueOf(i2);
          arrayOfObject16[2] = Integer.valueOf(i2);
          arrayOfObject16[3] = Integer.valueOf(2131427473);
          arrayOfObject16[4] = Integer.valueOf(UpdaterFragment.access$6(UpdaterFragment.this));
          publishProgress(arrayOfObject16);
          localProcess1 = null;
          i3 = i2 + 1;
        }
        label4966: int i4;
        int i5;
        String str3;
        try
        {
          Object[] arrayOfObject23 = new Object[4];
          arrayOfObject23[0] = Integer.valueOf(j);
          arrayOfObject23[1] = Integer.valueOf(i3 - 1);
          arrayOfObject23[2] = Integer.valueOf(i3);
          arrayOfObject23[3] = Integer.valueOf(2131427490);
          publishProgress(arrayOfObject23);
          localProcess1 = Runtime.getRuntime().exec("su");
          DataOutputStream localDataOutputStream = new DataOutputStream(localProcess1.getOutputStream());
          BufferedReader localBufferedReader = new BufferedReader(new InputStreamReader(new DataInputStream(localProcess1.getInputStream())), 64);
          UpdaterFragment localUpdaterFragment1 = UpdaterFragment.this;
          String[] arrayOfString1 = new String[4];
          arrayOfString1[0] = UpdaterFragment.access$11(UpdaterFragment.this);
          arrayOfString1[1] = "touch /data/sutest &&";
          arrayOfString1[2] = UpdaterFragment.access$11(UpdaterFragment.this);
          arrayOfString1[3] = "echo YEAH";
          String str4 = localUpdaterFragment1.executeCommand(localDataOutputStream, localBufferedReader, 1000, arrayOfString1);
          if ((str4 == null) || (!str4.equals("YEAH")))
          {
            Object[] arrayOfObject24 = new Object[5];
            arrayOfObject24[0] = Integer.valueOf(j);
            arrayOfObject24[1] = Integer.valueOf(i3 - 1);
            arrayOfObject24[2] = Integer.valueOf(i3);
            arrayOfObject24[3] = Integer.valueOf(2131427474);
            arrayOfObject24[4] = Integer.valueOf(UpdaterFragment.access$7(UpdaterFragment.this));
            publishProgress(arrayOfObject24);
            Integer localInteger1 = Integer.valueOf(3);
            localObject1 = localInteger1;
          }
          while (true)
          {
            localProcess1.destroy();
            break;
            Object[] arrayOfObject15 = new Object[5];
            arrayOfObject15[0] = Integer.valueOf(j);
            arrayOfObject15[1] = Integer.valueOf(i2 - 1);
            arrayOfObject15[2] = Integer.valueOf(i2);
            arrayOfObject15[3] = Integer.valueOf(2131427474);
            arrayOfObject15[4] = Integer.valueOf(UpdaterFragment.access$7(UpdaterFragment.this));
            publishProgress(arrayOfObject15);
            localObject1 = Integer.valueOf(3);
            break;
            Object[] arrayOfObject25 = new Object[5];
            arrayOfObject25[0] = Integer.valueOf(j);
            arrayOfObject25[1] = Integer.valueOf(i3);
            arrayOfObject25[2] = Integer.valueOf(i3);
            arrayOfObject25[3] = Integer.valueOf(2131427473);
            arrayOfObject25[4] = Integer.valueOf(UpdaterFragment.access$6(UpdaterFragment.this));
            publishProgress(arrayOfObject25);
            i3++;
            Object[] arrayOfObject26 = new Object[4];
            arrayOfObject26[0] = Integer.valueOf(j);
            arrayOfObject26[1] = Integer.valueOf(i3 - 1);
            arrayOfObject26[2] = Integer.valueOf(i3);
            arrayOfObject26[3] = Integer.valueOf(2131427491);
            publishProgress(arrayOfObject26);
            UpdaterFragment localUpdaterFragment2 = UpdaterFragment.this;
            String[] arrayOfString2 = new String[1];
            arrayOfString2[0] = (UpdaterFragment.this.mBusyboxPath + " mount -o remount,rw /system");
            localUpdaterFragment2.executeCommand(localDataOutputStream, null, arrayOfString2);
            UpdaterFragment localUpdaterFragment3 = UpdaterFragment.this;
            String[] arrayOfString3 = new String[1];
            arrayOfString3[0] = (UpdaterFragment.this.mBusyboxPath + " touch /system/su && " + UpdaterFragment.access$11(UpdaterFragment.this) + " echo YEAH");
            String str5 = localUpdaterFragment3.executeCommand(localDataOutputStream, localBufferedReader, arrayOfString3);
            if ((str5 == null) || (!str5.equals("YEAH")))
            {
              Object[] arrayOfObject27 = new Object[5];
              arrayOfObject27[0] = Integer.valueOf(j);
              arrayOfObject27[1] = Integer.valueOf(i3 - 1);
              arrayOfObject27[2] = Integer.valueOf(i3);
              arrayOfObject27[3] = Integer.valueOf(2131427474);
              arrayOfObject27[4] = Integer.valueOf(UpdaterFragment.access$7(UpdaterFragment.this));
              publishProgress(arrayOfObject27);
              Integer localInteger2 = Integer.valueOf(2131427501);
              localObject1 = localInteger2;
              localProcess1.destroy();
              break;
            }
            Object[] arrayOfObject28 = new Object[5];
            arrayOfObject28[0] = Integer.valueOf(j);
            arrayOfObject28[1] = Integer.valueOf(i3);
            arrayOfObject28[2] = Integer.valueOf(i3);
            arrayOfObject28[3] = Integer.valueOf(2131427473);
            arrayOfObject28[4] = Integer.valueOf(UpdaterFragment.access$6(UpdaterFragment.this));
            publishProgress(arrayOfObject28);
            i3++;
            Object[] arrayOfObject29 = new Object[4];
            arrayOfObject29[0] = Integer.valueOf(j);
            arrayOfObject29[1] = Integer.valueOf(i3 - 1);
            arrayOfObject29[2] = Integer.valueOf(i3);
            arrayOfObject29[3] = Integer.valueOf(2131427492);
            publishProgress(arrayOfObject29);
            UpdaterFragment localUpdaterFragment4 = UpdaterFragment.this;
            String[] arrayOfString4 = new String[6];
            arrayOfString4[0] = UpdaterFragment.access$11(UpdaterFragment.this);
            arrayOfString4[1] = "cp";
            arrayOfString4[2] = str2;
            arrayOfString4[3] = "/system &&";
            arrayOfString4[4] = UpdaterFragment.access$11(UpdaterFragment.this);
            arrayOfString4[5] = "echo YEAH";
            String str6 = localUpdaterFragment4.executeCommand(localDataOutputStream, localBufferedReader, arrayOfString4);
            if ((str6 == null) || (!str6.equals("YEAH")))
            {
              Object[] arrayOfObject30 = new Object[5];
              arrayOfObject30[0] = Integer.valueOf(j);
              arrayOfObject30[1] = Integer.valueOf(i3 - 1);
              arrayOfObject30[2] = Integer.valueOf(i3);
              arrayOfObject30[3] = Integer.valueOf(2131427474);
              arrayOfObject30[4] = Integer.valueOf(UpdaterFragment.access$7(UpdaterFragment.this));
              publishProgress(arrayOfObject30);
              localObject1 = Integer.valueOf(3);
              continue;
            }
            Object[] arrayOfObject31 = new Object[5];
            arrayOfObject31[0] = Integer.valueOf(j);
            arrayOfObject31[1] = Integer.valueOf(i3);
            arrayOfObject31[2] = Integer.valueOf(i3);
            arrayOfObject31[3] = Integer.valueOf(2131427473);
            arrayOfObject31[4] = Integer.valueOf(UpdaterFragment.access$6(UpdaterFragment.this));
            publishProgress(arrayOfObject31);
            i3++;
            Object[] arrayOfObject32 = new Object[4];
            arrayOfObject32[0] = Integer.valueOf(j);
            arrayOfObject32[1] = Integer.valueOf(i3 - 1);
            arrayOfObject32[2] = Integer.valueOf(i3);
            arrayOfObject32[3] = Integer.valueOf(2131427487);
            publishProgress(arrayOfObject32);
            UpdaterFragment localUpdaterFragment5 = UpdaterFragment.this;
            String[] arrayOfString5 = new String[2];
            arrayOfString5[0] = UpdaterFragment.access$11(UpdaterFragment.this);
            arrayOfString5[1] = "md5sum /system/su";
            String str7 = localUpdaterFragment5.executeCommand(localDataOutputStream, localBufferedReader, arrayOfString5);
            if ((str7 == null) || (!str7.split(" ")[0].equals(UpdaterFragment.this.mManifest.binaryMd5)))
            {
              Object[] arrayOfObject33 = new Object[5];
              arrayOfObject33[0] = Integer.valueOf(j);
              arrayOfObject33[1] = Integer.valueOf(i3 - 1);
              arrayOfObject33[2] = Integer.valueOf(i3);
              arrayOfObject33[3] = Integer.valueOf(2131427474);
              arrayOfObject33[4] = Integer.valueOf(UpdaterFragment.access$7(UpdaterFragment.this));
              publishProgress(arrayOfObject33);
              localObject1 = Integer.valueOf(3);
              continue;
            }
            Object[] arrayOfObject34 = new Object[5];
            arrayOfObject34[0] = Integer.valueOf(j);
            arrayOfObject34[1] = Integer.valueOf(i3);
            arrayOfObject34[2] = Integer.valueOf(i3);
            arrayOfObject34[3] = Integer.valueOf(2131427473);
            arrayOfObject34[4] = Integer.valueOf(UpdaterFragment.access$6(UpdaterFragment.this));
            publishProgress(arrayOfObject34);
            i3++;
            Object[] arrayOfObject35 = new Object[4];
            arrayOfObject35[0] = Integer.valueOf(j);
            arrayOfObject35[1] = Integer.valueOf(i3 - 1);
            arrayOfObject35[2] = Integer.valueOf(i3);
            arrayOfObject35[3] = Integer.valueOf(2131427493);
            publishProgress(arrayOfObject35);
            UpdaterFragment localUpdaterFragment6 = UpdaterFragment.this;
            String[] arrayOfString6 = new String[5];
            arrayOfString6[0] = UpdaterFragment.access$11(UpdaterFragment.this);
            arrayOfString6[1] = "chmod 06755 /system/su";
            arrayOfString6[2] = "&&";
            arrayOfString6[3] = UpdaterFragment.access$11(UpdaterFragment.this);
            arrayOfString6[4] = "echo YEAH";
            String str8 = localUpdaterFragment6.executeCommand(localDataOutputStream, localBufferedReader, arrayOfString6);
            if ((str8 == null) || (!str8.equals("YEAH")))
            {
              Object[] arrayOfObject36 = new Object[5];
              arrayOfObject36[0] = Integer.valueOf(j);
              arrayOfObject36[1] = Integer.valueOf(i3 - 1);
              arrayOfObject36[2] = Integer.valueOf(i3);
              arrayOfObject36[3] = Integer.valueOf(2131427474);
              arrayOfObject36[4] = Integer.valueOf(UpdaterFragment.access$7(UpdaterFragment.this));
              publishProgress(arrayOfObject36);
            }
            Object[] arrayOfObject37 = new Object[5];
            arrayOfObject37[0] = Integer.valueOf(j);
            arrayOfObject37[1] = Integer.valueOf(i3);
            arrayOfObject37[2] = Integer.valueOf(i3);
            arrayOfObject37[3] = Integer.valueOf(2131427473);
            arrayOfObject37[4] = Integer.valueOf(UpdaterFragment.access$6(UpdaterFragment.this));
            publishProgress(arrayOfObject37);
            i3++;
            Object[] arrayOfObject38 = new Object[4];
            arrayOfObject38[0] = Integer.valueOf(j);
            arrayOfObject38[1] = Integer.valueOf(i3 - 1);
            arrayOfObject38[2] = Integer.valueOf(i3);
            arrayOfObject38[3] = Integer.valueOf(2131427494);
            publishProgress(arrayOfObject38);
            UpdaterFragment localUpdaterFragment7 = UpdaterFragment.this;
            String[] arrayOfString7 = new String[6];
            arrayOfString7[0] = UpdaterFragment.access$11(UpdaterFragment.this);
            arrayOfString7[1] = "mv /system/su";
            arrayOfString7[2] = str1;
            arrayOfString7[3] = "&&";
            arrayOfString7[4] = UpdaterFragment.access$11(UpdaterFragment.this);
            arrayOfString7[5] = "echo YEAH";
            String str9 = localUpdaterFragment7.executeCommand(localDataOutputStream, localBufferedReader, arrayOfString7);
            if ((str9 == null) || (!str9.equals("YEAH")))
            {
              Object[] arrayOfObject39 = new Object[5];
              arrayOfObject39[0] = Integer.valueOf(j);
              arrayOfObject39[1] = Integer.valueOf(i3 - 1);
              arrayOfObject39[2] = Integer.valueOf(i3);
              arrayOfObject39[3] = Integer.valueOf(2131427474);
              arrayOfObject39[4] = Integer.valueOf(UpdaterFragment.access$7(UpdaterFragment.this));
              publishProgress(arrayOfObject39);
              localObject1 = Integer.valueOf(3);
              continue;
            }
            Object[] arrayOfObject40 = new Object[5];
            arrayOfObject40[0] = Integer.valueOf(j);
            arrayOfObject40[1] = Integer.valueOf(i3);
            arrayOfObject40[2] = Integer.valueOf(i3);
            arrayOfObject40[3] = Integer.valueOf(2131427473);
            arrayOfObject40[4] = Integer.valueOf(UpdaterFragment.access$6(UpdaterFragment.this));
            publishProgress(arrayOfObject40);
            i3++;
            Object[] arrayOfObject41 = new Object[4];
            arrayOfObject41[0] = Integer.valueOf(j);
            arrayOfObject41[1] = Integer.valueOf(i3 - 1);
            arrayOfObject41[2] = Integer.valueOf(i3);
            arrayOfObject41[3] = Integer.valueOf(2131427487);
            publishProgress(arrayOfObject41);
            UpdaterFragment localUpdaterFragment8 = UpdaterFragment.this;
            String[] arrayOfString8 = new String[3];
            arrayOfString8[0] = UpdaterFragment.access$11(UpdaterFragment.this);
            arrayOfString8[1] = "md5sum";
            arrayOfString8[2] = str1;
            String str10 = localUpdaterFragment8.executeCommand(localDataOutputStream, localBufferedReader, arrayOfString8);
            if ((str10 != null) && (str10.split(" ")[0].equals(UpdaterFragment.this.mManifest.binaryMd5)))
              break label4966;
            Object[] arrayOfObject42 = new Object[5];
            arrayOfObject42[0] = Integer.valueOf(j);
            arrayOfObject42[1] = Integer.valueOf(i3 - 1);
            arrayOfObject42[2] = Integer.valueOf(i3);
            arrayOfObject42[3] = Integer.valueOf(2131427474);
            arrayOfObject42[4] = Integer.valueOf(UpdaterFragment.access$7(UpdaterFragment.this));
            publishProgress(arrayOfObject42);
            localObject1 = Integer.valueOf(3);
          }
          Object[] arrayOfObject43 = new Object[5];
          arrayOfObject43[0] = Integer.valueOf(j);
          arrayOfObject43[1] = Integer.valueOf(i3);
          arrayOfObject43[2] = Integer.valueOf(i3);
          arrayOfObject43[3] = Integer.valueOf(2131427473);
          arrayOfObject43[4] = Integer.valueOf(UpdaterFragment.access$6(UpdaterFragment.this));
          publishProgress(arrayOfObject43);
          i3++;
          Object[] arrayOfObject44 = new Object[4];
          arrayOfObject44[0] = Integer.valueOf(j);
          arrayOfObject44[1] = Integer.valueOf(i3 - 1);
          arrayOfObject44[2] = Integer.valueOf(i3);
          arrayOfObject44[3] = Integer.valueOf(2131427495);
          publishProgress(arrayOfObject44);
          UpdaterFragment localUpdaterFragment9 = UpdaterFragment.this;
          String[] arrayOfString9 = new String[2];
          arrayOfString9[0] = UpdaterFragment.access$11(UpdaterFragment.this);
          arrayOfString9[1] = "mount -o remount,ro /system";
          localUpdaterFragment9.executeCommand(localDataOutputStream, null, arrayOfString9);
          UpdaterFragment localUpdaterFragment10 = UpdaterFragment.this;
          String[] arrayOfString10 = new String[4];
          arrayOfString10[0] = UpdaterFragment.access$11(UpdaterFragment.this);
          arrayOfString10[1] = "touch /system/su ||";
          arrayOfString10[2] = UpdaterFragment.access$11(UpdaterFragment.this);
          arrayOfString10[3] = "echo YEAH";
          String str11 = localUpdaterFragment10.executeCommand(localDataOutputStream, localBufferedReader, arrayOfString10);
          if ((str11 == null) || (!str11.equals("YEAH")))
          {
            Object[] arrayOfObject45 = new Object[5];
            arrayOfObject45[0] = Integer.valueOf(j);
            arrayOfObject45[1] = Integer.valueOf(i3 - 1);
            arrayOfObject45[2] = Integer.valueOf(i3);
            arrayOfObject45[3] = Integer.valueOf(2131427474);
            arrayOfObject45[4] = Integer.valueOf(UpdaterFragment.access$7(UpdaterFragment.this));
            publishProgress(arrayOfObject45);
            Object[] arrayOfObject46 = new Object[4];
            arrayOfObject46[0] = Integer.valueOf(j);
            arrayOfObject46[1] = Integer.valueOf(i3);
            arrayOfObject46[2] = Integer.valueOf(i3);
            arrayOfObject46[3] = Integer.valueOf(2131427497);
            publishProgress(arrayOfObject46);
          }
          while (true)
          {
            localDataOutputStream.writeBytes("exit\n");
            localProcess1.destroy();
            i4 = i3 + 1;
            Object[] arrayOfObject17 = new Object[4];
            arrayOfObject17[0] = Integer.valueOf(j);
            arrayOfObject17[1] = Integer.valueOf(i4 - 1);
            arrayOfObject17[2] = Integer.valueOf(i4);
            arrayOfObject17[3] = Integer.valueOf(2131427483);
            publishProgress(arrayOfObject17);
            i5 = Util.getSuVersionCode();
            str3 = Util.getSuVersion();
            if (str3 != null)
              break label5557;
            Object[] arrayOfObject22 = new Object[5];
            arrayOfObject22[0] = Integer.valueOf(j);
            arrayOfObject22[1] = Integer.valueOf(i4);
            arrayOfObject22[2] = Integer.valueOf(i4);
            arrayOfObject22[3] = Integer.valueOf(2131427474);
            arrayOfObject22[4] = Integer.valueOf(UpdaterFragment.access$7(UpdaterFragment.this));
            publishProgress(arrayOfObject22);
            localObject1 = Integer.valueOf(3);
            break;
            Object[] arrayOfObject47 = new Object[5];
            arrayOfObject47[0] = Integer.valueOf(j);
            arrayOfObject47[1] = Integer.valueOf(i3);
            arrayOfObject47[2] = Integer.valueOf(i3);
            arrayOfObject47[3] = Integer.valueOf(2131427473);
            arrayOfObject47[4] = Integer.valueOf(UpdaterFragment.access$6(UpdaterFragment.this));
            publishProgress(arrayOfObject47);
          }
        }
        catch (IOException localIOException1)
        {
          while (true)
          {
            Log.e("Su.UpdaterFragment", "Failed to execute root commands", localIOException1);
            localProcess1.destroy();
          }
        }
        finally
        {
          localProcess1.destroy();
        }
        label5557: if (i5 == UpdaterFragment.this.mManifest.versionCode)
        {
          Object[] arrayOfObject19 = new Object[5];
          arrayOfObject19[0] = Integer.valueOf(j);
          arrayOfObject19[1] = Integer.valueOf(i4);
          arrayOfObject19[2] = Integer.valueOf(i4);
          arrayOfObject19[3] = str3;
          arrayOfObject19[4] = Integer.valueOf(UpdaterFragment.access$6(UpdaterFragment.this));
          publishProgress(arrayOfObject19);
          int i6 = i4 + 1;
          Object[] arrayOfObject20 = new Object[4];
          arrayOfObject20[0] = Integer.valueOf(j);
          arrayOfObject20[1] = Integer.valueOf(i6 - 1);
          arrayOfObject20[2] = Integer.valueOf(i6);
          arrayOfObject20[3] = Integer.valueOf(2131427496);
          publishProgress(arrayOfObject20);
          UpdaterFragment.this.getActivity().deleteFile("busybox");
          UpdaterFragment.this.getActivity().deleteFile("su");
          if (i != 0)
            UpdaterFragment.this.getActivity().deleteDatabase("permissions.sqlite");
          Object[] arrayOfObject21 = new Object[5];
          arrayOfObject21[0] = Integer.valueOf(j);
          arrayOfObject21[1] = Integer.valueOf(i6);
          arrayOfObject21[2] = Integer.valueOf(i6);
          arrayOfObject21[3] = Integer.valueOf(2131427473);
          arrayOfObject21[4] = Integer.valueOf(UpdaterFragment.access$6(UpdaterFragment.this));
          publishProgress(arrayOfObject21);
          localObject1 = Integer.valueOf(2);
          continue;
        }
        Object[] arrayOfObject18 = new Object[5];
        arrayOfObject18[0] = Integer.valueOf(j);
        arrayOfObject18[1] = Integer.valueOf(i4);
        arrayOfObject18[2] = Integer.valueOf(i4);
        arrayOfObject18[3] = str3;
        arrayOfObject18[4] = Integer.valueOf(UpdaterFragment.access$7(UpdaterFragment.this));
        publishProgress(arrayOfObject18);
        UpdaterFragment.this.mCurrentStep = UpdaterFragment.Step.DOWNLOAD_BUSYBOX;
        localObject1 = Integer.valueOf(3);
      }
    }

    protected void onCancelled()
    {
      Log.d("Su.UpdaterFragment", "UpdaterTask cancelled");
    }

    protected void onPostExecute(Integer paramInteger)
    {
      UpdaterFragment.this.mTitleProgress.setVisibility(8);
      UpdaterFragment.this.mActionButton.setEnabled(true);
      switch (paramInteger.intValue())
      {
      default:
      case 1:
      case 4:
      case 2:
      case 3:
      case 5:
      case 2131427500:
      case 2131427501:
      }
      while (true)
      {
        return;
        UpdaterFragment.this.mActionButton.setText(2131427467);
        UpdaterFragment.this.mStatusText.setText(2131427465);
        continue;
        UpdaterFragment.this.mActionButton.setText(2131427468);
        UpdaterFragment.this.mStatusText.setText(2131427466);
        continue;
        UpdaterFragment.this.mActionButton.setText(2131427469);
        UpdaterFragment.this.mStatusText.setText(2131427479);
        ((NotificationManager)UpdaterFragment.this.getActivity().getSystemService("notification")).cancel(1);
        continue;
        UpdaterFragment.this.mActionButton.setText(2131427478);
        UpdaterFragment.this.mStatusText.setText(2131427476);
        continue;
        UpdaterFragment.this.mActionButton.setText(2131427478);
        UpdaterFragment.this.mStatusText.setText(2131427477);
        continue;
        new AlertDialog.Builder(UpdaterFragment.this.getActivity()).setMessage(paramInteger.intValue()).setPositiveButton(2131427351, new DialogInterface.OnClickListener()
        {
          public void onClick(DialogInterface paramDialogInterface, int paramInt)
          {
            UpdaterFragment.this.getActivity().finish();
          }
        }).create().show();
      }
    }

    protected void onPreExecute()
    {
      UpdaterFragment.this.mTitleProgress.setVisibility(0);
      UpdaterFragment.this.mStatusText.setText(2131427470);
      UpdaterFragment.this.mActionButton.setText(2131427470);
      UpdaterFragment.this.mActionButton.setEnabled(false);
    }

    protected void onProgressUpdate(Object[] paramArrayOfObject)
    {
      if (isCancelled());
      while (true)
      {
        return;
        UpdaterFragment.this.getListAdapter().notifyDataSetChanged();
        UpdaterFragment.this.mProgressBar.setMax(((Integer)paramArrayOfObject[0]).intValue());
        UpdaterFragment.this.mProgressBar.setProgress(((Integer)paramArrayOfObject[1]).intValue());
        UpdaterFragment.this.mProgressBar.setSecondaryProgress(((Integer)paramArrayOfObject[2]).intValue());
        if (paramArrayOfObject.length == 4)
        {
          UpdaterFragment.this.addConsoleEntry(((Integer)paramArrayOfObject[3]).intValue());
          continue;
        }
        if (paramArrayOfObject.length != 5)
          continue;
        if ((paramArrayOfObject[3] instanceof String))
        {
          UpdaterFragment.this.addStatusToEntry((String)paramArrayOfObject[3], ((Integer)paramArrayOfObject[4]).intValue());
          continue;
        }
        if ((paramArrayOfObject[3] instanceof Integer))
        {
          UpdaterFragment.this.addStatusToEntry(((Integer)paramArrayOfObject[3]).intValue(), ((Integer)paramArrayOfObject[4]).intValue());
          continue;
        }
        UpdaterFragment.this.addStatusToEntry(2131427474, UpdaterFragment.this.CONSOLE_RED);
      }
    }
  }
}

/* Location:           D:\Development\Decompile_Workspace\슈퍼유저-41\classes_dex2jar.jar
 * Qualified Name:     com.noshufou.android.su.UpdaterFragment
 * JD-Core Version:    0.6.0
 */